package org.example.demo;

import org.elasticsearch.action.delete.DeleteRequest;
import org.elasticsearch.action.delete.DeleteResponse;
import org.elasticsearch.client.RequestOptions;
import org.example.task.ConnectElasticsearch;


/**
 * @Author wangf
 * @Description 删除文档
 * @Date 2023/3/2 19:29
 */
public class DeleteDoc {
    public static void main(String[] args) {
        ConnectElasticsearch.connect(client -> {
            //创建请求对象
            DeleteRequest request = new DeleteRequest();
            //客户端发送请求，获取响应对象
            DeleteResponse deleteResponse = client.delete(request, RequestOptions.DEFAULT);
            //打印结果信息
            System.out.println(deleteResponse.toString());
        });
    }
}
